import java.util.HashMap;

class Course {
    public Integer no;
    public String name;
    public int time;

    Course(int no,String name,int time) {
        this.no=no;
        this.name=name;
        this.time=time;
    }

    @Override
    public int hashCode() {
        return this.no;
    }

    @Override
    public boolean equals(Object o) {
        Course ro=(Course)o;
        return this.no.equals(ro.no);
    }

    @Override
    public String toString() {
        return String.valueOf(no)+" "+this.name+" "+String.valueOf(time);
    }
}

class CourseMap {
    private HashMap<Integer,Course> zx=new HashMap<Integer,Course>();

    public void add(Course r) {
        if(zx.get(r.no)==null) {
            zx.put(r.no,r);
            System.out.println("成功");
        }
        else
            System.out.println("已存在");
    }

    public void remove(int no) {
        if(zx.remove(no)!=null)
            System.out.println("成功");
        else
            System.out.println("失败");
    }

    public void search() {
        for(var i : zx.entrySet())
            System.out.println(i.getValue());
    }
}

class TestCourseMap {
    TestCourseMap() {
        var cm=new CourseMap();
        cm.add(new Course(1,"打招新",1));
        cm.add(new Course(2,"打像",1));
        cm.add(new Course(3,"打统统",1));
        cm.add(new Course(1,"打招新",1));
        cm.remove(3);
        cm.search();
    }
}

public class exam2 {
    public static void main(String[] args) {
        new TestCourseMap();
    }
}
